package cn.faifai.framework.utils.fetcher.fileIdFetcher;

import cn.faifai.framework.utils.fetcher.fileIdFetcher.impl.WindowsFileIdFetcher;

import java.io.IOException;

public class FileIdFetcherFactory {

    public static FileIdFetcher getFileIdFetcher() {
        return getFileIdFetcher(System.getProperty("os.name"));
    }

    public static FileIdFetcher getFileIdFetcher(String osName) {
        osName = osName.toLowerCase();
        if (osName.contains("win")) {
            return new WindowsFileIdFetcher();
        } else if (osName.contains("nix") || osName.contains("nux") || osName.contains("mac")) {
//            return new LinuxFileIdFetcher();
            return null;
        } else {
            throw new UnsupportedOperationException("Unsupported operating system: " + osName);
        }
    }

    public static void main(String[] args) throws IOException {
        FileIdFetcher fileIdFetcher = FileIdFetcherFactory.getFileIdFetcher(System.getProperty("os.name"));
        String fileId = fileIdFetcher.getFileId("D:\\$RECYCLE.BIN\\S-1-5-21-463390504-2282240019-982843704-1001\\$RCDZMKE.txt");
        System.out.println(fileId);
        String[] split = fileId.split("#");
        for (String s : split) System.out.println(s);
    }
}
